package com.ruoyi.system.util;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.io.File;

/**
 * 读取项目相关配置
 *
 * @author wdc

 */
@Component
@ConfigurationProperties(prefix = "wdc")
public class DataPathProperties {

    /**
     * 目标整编
     */
    private static String mbzbsjglFile;
    /**
     * 部署体系
     */
    private static String bstxsjglFile;

    /**
     * 判读样片
     */
    private static String pdypFile;

    public static String getMbzbsjglFile() {
        return mbzbsjglFile;
    }

    public static void setMbzbsjglFile(String mbzbsjglFile) {
        DataPathProperties.mbzbsjglFile = mbzbsjglFile;
    }

    public static String getBstxsjglFile() {
        return bstxsjglFile;
    }

    public static void setBstxsjglFile(String bstxsjglFile) {
        DataPathProperties.bstxsjglFile = bstxsjglFile;
    }

    public static String getPdypFile() {
        return pdypFile;
    }

    public static void setPdypFile(String pdypFile) {
        DataPathProperties.pdypFile = pdypFile;
    }

    public static String getMBZBSavePath() {

        return  File.separator + "mbzbsjgl" ;
    }

    public static String getBSTXSavePath() {
        return  File.separator + "bstxsjgl" ;
    }

    public static String getPDYPSavePath() {
        return  File.separator + "pdyp";
    }
    public static String getCGSJSavePath() {
        return  File.separator + "mbcgsj";
    }

    /**
     * 获取文件存储地址
     *
     * @param code
     * @return java.lang.String
     */
    public static String getFileSavePath(Integer code) {
        if (code == DataFileRelationDataTypeEnums.MBZB.getCode()) return getMBZBSavePath();
        if (code == DataFileRelationDataTypeEnums.PDYP.getCode()) return getPDYPSavePath();
        if (code == DataFileRelationDataTypeEnums.BSTX.getCode()) return getBSTXSavePath();
        if (code == DataFileRelationDataTypeEnums.CGSJ.getCode()) return getCGSJSavePath();

        return null;
    }


    public static String getcd(Integer code) {
        if (code == DataFileRelationDataTypeEnums.MBZB.getCode()) return "mbzbsjgl";
        if (code == DataFileRelationDataTypeEnums.PDYP.getCode()) return "pdyp";
        if (code == DataFileRelationDataTypeEnums.BSTX.getCode()) return "bstxsjgl";
        if (code == DataFileRelationDataTypeEnums.CGSJ.getCode()) return "mbcgsj";

        return null;
    }

}
